package cc.vv.btpartyjob.partymanager.adapter

import android.widget.TextView
import cc.vv.baselibrary.adapter.SimpleCommonAdapter
import cc.vv.baselibrary.adapter.holder.ExtendViewHolder
import cc.vv.baselibrary.view.OvalImageView
import cc.vv.btpartyjob.jnimodule.server.OperationServer
import cc.vv.btpartyjob.partymanager.R
import cc.vv.btpartyjob.partymanager.moudel.bean.StreetActivitiesObj
import cc.vv.lkimagecomponent2.LKImage
import cc.vv.lkimagecomponent2.lib.mode.ScaleMode

/**
 * 活动列表adapter
 * Created by Chen.qi on 2018/10/24.
 */
class ActivitiesListAdapter(layoutResId: Int) : SimpleCommonAdapter<StreetActivitiesObj>(layoutResId) {
    override fun convert(helper: ExtendViewHolder, item: StreetActivitiesObj, position: Int) {

        LKImage.load().scale(ScaleMode.CENTER_CROP)
                .crossFade(300).placeHolder(R.mipmap.icon_def_image)
                .error(R.mipmap.icon_def_image).load(item.cover).into(helper.getView<OvalImageView>(R.id.oiv_ial_itemPic))

        //titile
        helper.getView<TextView>(R.id.tv_ial_listTitle)?.text = item.title

        //时间
        helper.getView<TextView>(R.id.tv_ial_listDataTime)?.text = OperationServer.formatStr(item.activityTime)

        //浏览量
        helper.getView<TextView>(R.id.tv_ial_lookNumber)?.text = item.browseNum

    }
}